//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.zkkz.boot.restTemplate.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import org.springframework.lang.Nullable;

import java.io.Serializable;

@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@JsonIgnoreProperties(
        value = {"handler", "hibernateLazyInitializer", "fieldHandler"},
        ignoreUnknown = true
)
public class ResultResp<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    protected Integer code;
    protected String message;
    @Nullable
    protected T data;
    protected String traceId;
    @JsonIgnore
    @Nullable
    protected Throwable exception;

    public ResultResp() {
        this.code = StatusCode.SUCCESS.getCode();
        this.message = StatusCode.SUCCESS.getMessage();
        this.data = null;
        this.traceId = "";
        this.exception = null;
    }

    public ResultResp(T data) {
        this();
        this.data = data;
    }

    public ResultResp(int code, String message) {
        this();
        this.code = code;
        this.message = message;
        this.data = null;
    }

    public ResultResp(int code, String message, T data) {
        this();
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public int getCode() {
        return this.code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Nullable
    public T getData() {
        return this.data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getTraceId() {
        return this.traceId;
    }

    public void setTraceId(String traceId) {
        this.traceId = traceId;
    }

    @Nullable
    public Throwable getException() {
        return this.exception;
    }

    public void setException(Throwable exception) {
        this.exception = exception;
    }

    public String toString() {
        return "{\"code\":" + this.code + ", \"message\":\"" + this.message + "\", \"data\":\"" + this.data + "\", \"trace_id\":\"" + this.traceId + "\", \"exception\":\"" + this.exception + "\"" + '}';
    }
}
